import { Column, Entity, JoinColumn, OneToOne } from 'typeorm';

import { User } from './user.entity';
import { BaseEntity } from '../../infra/entity/base';

@Entity({ name: 'nest_profile' })
export class Profile extends BaseEntity {
  @Column('smallint', { default: 0, nullable: true, comment: '0: 女 1: 男' })
  gender: number;

  @Column('varchar', { default: '', nullable: true })
  avatar: string;

  @OneToOne(() => User, {
    cascade: true,
    onDelete: 'CASCADE',
    onUpdate: 'CASCADE',
  })
  @JoinColumn()
  user: User;
}
